<% layout('layout.ejs') -%>
<div ng-controller="EditUserCtr" ng-cloak class="ng-cloak">
    <form name="addUser_form">
    <div class="col-md-6">
        <div class="box box-primary">
            <div class="box-body">
                <div class="form-group">
                    <input class="form-control" type="text" name="username" placeholder="输入用户名" ng-model="user.name" ng-minlength="3" required>
                    <small class="error" ng-show="addUser_form.username.$error.minlength">最少输入3个</small>
                </div>
                <div class="form-group">
                    <input class="form-control" type="password" id="password" name="password" placeholder="输入密码" ng-model="user.password" required>
                    <small ng-show="addUser_form.surepass.$dirty  &&  addUser_form.password.$error.required">
                        请填写密码
                    </small>
                </div>
                <div class="form-group">
                    <input class="form-control" type="password" name="surepass" placeholder="确认密码" ng-model="user.surepass" pw-check="password" required>
                    <small ng-show="addUser_form.surepass.$dirty  &&  addUser_form.surepass.$error.required">
                        请确认密码
                    </small>
                    <small ng-show="addUser_form.surepass.$dirty  && addUser_form.surepass.$error.pwmatch">
                        两次密码不一致
                    </small>
                </div>
                <div class="form-group">
                    <input class="form-control" type="email" name="email" placeholder="输入邮箱" ng-model="user.email" required>
                    <small class="error" ng-show="addUser_form.email.$error.email">请正确输入邮箱号</small>
                </div>
                <div class="form-group">
                    <h3 class="box-title">管理城市</h3>
                    <div ng-repeat="manageCity in manageCities track by $index">
                        <div class="alert alert-info alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="delete_alert($index)">×</button>
                            <h4><i class="icon fa fa-info"></i> {{manageCity.city}}</h4>
                        </div>
                    </div>

                </div>
                <div class="form-group">
                    <div class="col-xs-6">
                        省份：
                        <select  class="form-control" ng-model="myProvince" ng-options="province.province for province in Provinces" ng-change="changeCity()"></select>
                    </div>
                    <div class="col-xs-6">
                        城市： <select  class="form-control" ng-model="myCity" ng-options="city.city for city in Cities"></select>
                    </div>
                    <button class="btn btn-primary" ng-click="add_managerCity()">添加</button>
                </div>
                <div style="clear: both;"></div>
                <div class="box-footer">
                    <button class="btn btn-primary" ng-click="save_user()">提交</button>
                    <button class="btn btn-primary" type="button" onclick="window.location='/basedata/userManage'">返回</button>
                </div>
            </div>
        </div>
    </div>
    </form>
</div>
<% block('footer').append('<script src="/script/basedata.js"></script>') %>
